package com.ruoyi.basedata.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.basedata.mapper.BaseReportMapper;
import com.ruoyi.basedata.service.IBaseReportService;

/**
 * 基础数据报表服务实现
 * 
 * @author ruoyi
 */
@Service
public class BaseReportServiceImpl implements IBaseReportService
{
    private static final Logger log = LoggerFactory.getLogger(BaseReportServiceImpl.class);
    
    @Autowired
    private BaseReportMapper baseReportMapper;

    /**
     * 查询商品名称和单价统计数据
     * 
     * @return 商品名称和单价统计数据列表
     */
    @Override
    public List<Map<String, Object>> selectProductCountData()
    {
        try {
            List<Map<String, Object>> data = baseReportMapper.selectProductCountData();
            return data != null ? data : new ArrayList<>();
        } catch (Exception e) {
            log.error("查询商品统计数据出错", e);
            return new ArrayList<>();
        }
    }
    
    /**
     * 查询商品采购量和销售量统计数据
     * 
     * @return 商品采购量和销售量统计数据列表
     */
    @Override
    public List<Map<String, Object>> selectProductVolumeData()
    {
        try {
            List<Map<String, Object>> data = baseReportMapper.selectProductVolumeData();
            return data != null ? data : new ArrayList<>();
        } catch (Exception e) {
            log.error("查询商品采购量和销售量数据出错", e);
            return new ArrayList<>();
        }
    }
} 